import { reqGetSearchInfo } from "@/api"
//模块小仓库
const state = {
    searchList:{}
}   
const mutations = {
    GETSEARCHLIST(state,searchList){
        state.searchList = searchList
}}
const actions = {
    async getSearchList({commit},params={}){
        const result = await reqGetSearchInfo(params)      
        if(result.code === 200){          
          
             
                commit('GETSEARCHLIST',result.data)
        }
    }
}
//计算属性，为了简化数据而生
const getters = {
    goodsList(state){
        //假如没有网络返回的是undifined，以防万一加一个数组
        return state.searchList.goodsList || [];
    },
    attrsList(state){
        return state.searchList.attrsList;
    },
    trademarkList(state){
        return state.searchList.trademarkList;
    }
}
export default {
    state,
    mutations,
    actions,
    getters
}